<!doctype html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  <meta name="Generator" content="EditPlus®">
  <meta name="Author" content="">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
  <title>Document</title>
 </head>
 <body>
    <button id="btn_1">警告框</button>
    <button id="btn_2">确认框</button>
	<button id="btn_3">输入框</button>
	<p id="p1"></p>
 </body>
 <script>
    var $ = function(obj){
	   return document.getElementById(obj);
	}
	window.onload = function(){
	   //警告框
	   var btn_1 = $("btn_1");
	   btn_1.onclick = function(){
	      window.alert("你好，我是警告框");
	   }
	   //确认框
	   var btn_2 = $("btn_2");
	   var p1 = $("p1");
	   btn_2.onclick = function(){
	     var f = window.confirm("按下按钮");
		 if(f){
		    p1.innerText = f;
		 }else{
		    p1.innerText = f;
		 }
	   }
	   var btn_3 = $("btn_3");
	   btn_3.onclick = function(){
	       var s = window.prompt("请输入内容");
		   p1.innerText = s;
	   }
	}
 </script>
</html>
